﻿using Gola.VN.Scb.Web.Bll;

namespace Gola.VN.Scb.Web.Presentation.Models
{
    class MainService
    {
        private static MainService _mainService;

        public CategoryService CategoryService { get; private set; }
        public ProviderService ProviderService { get; private set; }
        public ProductService ProductService { get; private set; }
        public SearchServiceNew SearchServiceNew { get; private set; }
        public SearchHistoryServiceNew SearchHistoryService { get; private set; }

        private MainService() { }

        public static MainService GetInstant()
        {
            if (_mainService == null)
            {
                MainBiz mainBiz = MainBiz.GetInstant();
                _mainService = new MainService
                                   {
                                       CategoryService = new CategoryService(mainBiz),
                                       ProductService = new ProductService(mainBiz),
                                       ProviderService = new ProviderService(mainBiz),
                                       SearchServiceNew = new SearchServiceNew(mainBiz),
                                       SearchHistoryService = new SearchHistoryServiceNew(mainBiz)
                                   };
            }

            return _mainService;
        }
    }
}